<?php
function _substr($str, $length, $minword = 3)
{
    $sub = '';
    $len = 0;
    foreach (explode(' ', $str) as $word)
    {
        $part = (($sub != '') ? ' ' : '') . $word;
        $sub .= $part;
        $len += strlen($part);
        if (strlen($word) > $minword && strlen($sub) >= $length)
        {
            break;
        }
    }
    return $sub . (($len < strlen($str)) ? '...' : '');
}
?>
<div class="MainContentInner">
<div id="content">
<div class="Intro">
    <div class="advanced-slider" id="lazy-loading-slider">
        <ul class="slides">
            <?php
                if(isset($slides) && $slides != null)
                foreach($slides as $slide){
            ?>
                <li class="slide" data-image="<?php echo $slide->img; ?>">
                    <a class="image" href="" target="_blank">
                        <img src="<?php echo $slide->img; ?>" width="690" height="276"/>
                    </a>

                    <div class="thumbnail">
                        <span class="title"><?php echo $slide->title ?></span>
                    </div>
                </li>
            <?php } ?>
        </ul>
    </div>
</div>

<div class="News">
    <div class="MainNews">
        <div>
            <div class="title-big-box">Giới thiệu phòng khám sản phụ khoa</div>
            <?php
                if(isset($bvGioiThieu) && $bvGioiThieu != null){
            ?>
            <img src="<?php echo $bvGioiThieu->img ?>" width="200" style="float: left; margin: 5px 10px 0px 5px"/>
            <div class="gioithieu">
            <?php echo $bvGioiThieu->mieu_ta; ?>
            </div>
            <p class="xemthem MoreSeeLink">
                <?php echo CHtml::link('Xem thêm...', array('baiviet/gioithieubaiviet','menu'=>'gioi-thieu', 'alias' => $bvGioiThieu->link, 'id' => $bvGioiThieu->id)); ?>
            </p>
            <?php
                }else{
                    echo '<div style="min-height: 100px;text-align: center; color: #ff0000;font-size: 15px;"> Không có bài viết giới thiệu !</div>';
                }
            ?>
            <div class="clearboth"></div>
        </div>
        <div class="ListNews" style="width: 100%">
            <div class="title-big-box">Thông tin y khoa</div>
            <ul>
                <?php
                if(isset($dsBaiVietTrangChu) && $dsBaiVietTrangChu != null)
                    foreach($dsBaiVietTrangChu as $baiViet){
                ?>
                    <li>
                        <?php if($baiViet->img != '' || $baiViet->img != null){ ?>

                            <a href="<?php echo Yii::app()->createUrl('baiviet/chitietbaiviet',array('nhom'=>$baiViet->dmnhombv->link,'alias'=>$baiViet->link,'id'=>$baiViet->id)); ?>" title="<?php echo $baiViet->ten_bv; ?>">
                                <img src="<?php echo $baiViet->img; ?>" width="150" />
                            </a>

                        <?php }?>
                        <div class="NewsContent">
                            <div class="title-new">
                                <?php echo CHtml::link($baiViet->ten_bv,array('baiviet/chitietbaiviet','nhom'=>$baiViet->dmnhombv->link,'alias'=>$baiViet->link,'id'=>$baiViet->id),array('title'=>$baiViet->ten_bv)); ?>
                            </div>
                            <p><?php echo _substr(strip_tags($baiViet->mieu_ta),100); ?></p>
                        </div>
                    </li>
                <?php }?>
            </ul>
        </div>
    </div>
    <div class="BoxNews">
        <div class="box-new">
            <div class="box-title">Giờ khám bệnh</div>
            <div>
                <p>Thứ 2 đến thứ 6 : 16h30 đến 20h.</p>
                <p>Thứ 7 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 16h đến 19h.</p>
                <p>Chủ Nhật&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 15h đến 19h.</p>
            </div>
        </div>
        <div class="box-new">
            <div class="box-title">Đăng ký khám bệnh</div>
            <div>
                <p> Vui lòng gọi điện đến:</p>
                <strong>0511 3519890/ 0913430545</strong>
                <p> Để đăng ký khám và được ưu tiên.</p>
            </div>
        </div>
        <?php $this->renderPartial('/common/bac_si_phu_trach'); ?>
    </div>
</div>
</div>
</div>